package ui_test;

import core.TestBase;
import org.testng.annotations.AfterSuite;
import pages.*;
import org.testng.annotations.Test;

/**
 * Created with IntelliJ IDEA.
 * User: u
 * Date: 7/20/14
 * Time: 6:17 PM
 * To change this template use File | Settings | File Templates.
 */
public class rozetka_actions extends TestBase {
    HomePage page = new HomePage();
    UserSettingsPage userpage;
    EditPage editPage;
    SavedDataPage savedDataPage;
    WishListPage wishList;
    SearchResultPage searchResult;
    SearchedProductPage productPage;

    @Test
    public void setUpPreconditions() {
        page.open();
        page.isOpened(TestData.HomeURL);
        page.signInPaneClick();
        page.signInViaFacebook();
        page.verifyUserNamePresent();
        userpage = page.toUserPageChange();
    }

    @Test(dependsOnMethods = {"setUpPreconditions"})
    public void userPageActions() {
        userpage.verifysettingsTitle();
        userpage.verifyUserMailAndName();
        editPage = userpage.editPageClick();
    }

    @Test(dependsOnMethods = {"userPageActions"})
    public void editPageActions() {
        editPage.editPageTitleVerify();
        editPage.pastAaddressesFindAndRemove();
        editPage.deliveryAddressChange();
        savedDataPage = editPage.submitClick();
    }

    @Test(dependsOnMethods = {"editPageActions"})
    public void savedDataPageActions() {
        savedDataPage.savedDataVerify();
        wishList = savedDataPage.wishListClick();
    }

    @Test(dependsOnMethods = {"savedDataPageActions"})
    public void wishListPageActions() {
        wishList.wishListCreation();
        wishList.firstWishCreation();
        wishList.wishAppearanceVerifying();
        searchResult = wishList.searchMaking();
    }

    @Test(dependsOnMethods = {"wishListPageActions"})
    public void searshResultPageActions() {
        searchResult.verifySearchResultPresent();
        productPage = searchResult.searchedProductNavigating();
    }
    
    
    
    @Test(dependsOnMethods ={"searshResultPageActions"})
    public void searchedProductPageActions(){
        productPage.productBuying();
        productPage.productAppearanceInBasketVerifying();
        productPage.justAddedProductRemoving();
        productPage.verifyingBasketIsEmpty();
        productPage.basketClosing();
        productPage.signOut();
        productPage.signOutVerify();
        productPage.urlVerify();
    }


    /*@AfterSuite
    public void waitOnClose() throws InterruptedException {
        Thread.sleep(90 * 1000);
    }*/
}
